import React from 'react';
import Footer from '@/components/footer'
import { SettingO, OrdersO, GoldCoinO, InfoO, Close } from '@react-vant/icons'


const BusinessInex = () => {
    let navigate = React.$router.useNavigate();
    const [user, setUser] = React.useState(React.$cookie.load('User') ?? {})
    const logout = async () => {
        try {
            await React.$vant.Dialog.confirm({
                message: '确认是否退出登陆?',
            })
            React.$cookie.remove('User', { path: '/' })
            navigate('/business/login')
        } catch (error) { }

    }




    return (
        <> 
            <div className="my_kuang">
                <div className="bj_img">
                    <img className="beij_s" src="/assets/images/my_beij.jpg" alt="" />
                    <div className="nimetou_gaib">
                        <div className="toux_hou">
                            <img id="Dfgrg" style={{ height: 1.1 + 'rem' }} src={user.avatar ?? "/assets/images/toux.jpg"} alt="" />
                            <input id="tupian_Sc" type="file" />
                        </div>
                        <div className="mingz">
                            <h2 >{user.nickname ?? '哈罗PUA520'}</h2>
                        </div>
                    </div>
                </div>
                <div className="div_bx_k">
                    <div className="neir_Ef">
                        <div className="yverjif">
                            <ul>
                                <li><h2>{user.cateCount}</h2><p>收藏文章</p></li>
                                <li><a href="my_cs.html"> <h2>{user.proCount}</h2><p>收藏商品</p></a></li>
                                <li><h2>0</h2><p>订单数量</p></li>
                            </ul>
                        </div>
                        <div className="list_index_my">
                            <div className="fenh_ziyek">
                                <h3>更多服务 </h3>
                            </div>
                            <React.$router.NavLink to="/business/profile">
                                <React.$vant.Cell title='基本资料' icon={<SettingO color='#ffc0cb' style={{ fontSize: '2em' }} />} isLink />
                            </React.$router.NavLink>

                            <React.$router.NavLink to="/business/order">
                            <React.$vant.Cell title='我的订单' icon={<OrdersO color='#ffc0cb' style={{ fontSize: '2em' }} />} isLink />
                            </React.$router.NavLink>
                            <React.$router.NavLink to="/business/record">
                            <React.$vant.Cell title='消费记录' icon={<GoldCoinO color='#ffc0cb' style={{ fontSize: '2em' }} />} isLink />
                            </React.$router.NavLink>
                            <React.$router.NavLink to="/business/about">
                                <React.$vant.Cell title='关于我们' icon={<InfoO color='#ffc0cb' style={{ fontSize: '2em' }} />} isLink />
                            </React.$router.NavLink>
                            <React.$vant.Cell title='退出登陆' icon={<Close color='#ffc0cb' style={{ fontSize: '2em' }} />} isLink onClick={logout} />

                        </div>
                        <div style={{ height: .9 + 'rem' }}></div>
                    </div>

                </div>
            </div>
            <div style={{ height: .75 + 'rem' }}></div>
            <Footer />
        </>
    )
}

export default BusinessInex;